<?php /* Smarty version 2.6.26, created on 2012-05-12 15:15:32
         compiled from controllers%5Cblocks.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'rlHook', 'controllers\\blocks.tpl', 5, false),array('function', 'fckEditor', 'controllers\\blocks.tpl', 113, false),array('modifier', 'cat', 'controllers\\blocks.tpl', 19, false),array('modifier', 'count', 'controllers\\blocks.tpl', 39, false),array('modifier', 'ceil', 'controllers\\blocks.tpl', 141, false),)), $this); ?>
<!-- blocks tpl -->

<!-- navigation bar -->
<div id="nav_bar">
	<?php echo rlHook::load(array('name' => 'apTplBlocksNavBar'), $this);?>


	<?php if ($this->_tpl_vars['aRights'][$this->_tpl_vars['cKey']]['add'] && $_GET['action'] != 'add'): ?>
		<a href="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=add" class="button_bar"><span class="left"></span><span class="center_add"><?php echo $this->_tpl_vars['lang']['add_block']; ?>
</span><span class="right"></span></a>
	<?php endif; ?>
	<a href="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=<?php echo $_GET['controller']; ?>
" class="button_bar"><span class="left"></span><span class="center_list"><?php echo $this->_tpl_vars['lang']['blocks_list']; ?>
</span><span class="right"></span></a>
</div>
<!-- navigation bar end -->

<?php if ($_GET['action']): ?>

	<?php $this->assign('sPost', $_POST); ?>

	<!-- add new/edit block -->
	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		<form action="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=<?php if ($_GET['action'] == 'add'): ?>add<?php elseif ($_GET['action'] == 'edit'): ?>edit&amp;block=<?php echo $_GET['block']; ?>
<?php endif; ?>" method="post" enctype="multipart/form-data">
			<input type="hidden" name="submit" value="1" />
			
			<?php if ($_GET['action'] == 'edit'): ?>
				<input type="hidden" name="fromPost" value="1" />
			<?php endif; ?>
			<table class="form">
			<tr>
				<td class="name"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['key']; ?>
</td>
				<td class="field">
					<input <?php if ($_GET['action'] == 'edit'): ?>readonly="readonly"<?php endif; ?> class="<?php if ($_GET['action'] == 'edit'): ?>disabled<?php endif; ?>" name="key" type="text" style="width: 150px;" value="<?php echo $this->_tpl_vars['sPost']['key']; ?>
" maxlength="30" />
				</td>
			</tr>

			<tr>
				<td class="name">
					<span class="red">*</span><?php echo $this->_tpl_vars['lang']['name']; ?>

				</td>
				<td>
					<?php if (count($this->_tpl_vars['allLangs']) > 1): ?>
						<ul class="tabs">
							<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['language']):
        $this->_foreach['langF']['iteration']++;
?>
							<li lang="<?php echo $this->_tpl_vars['language']['Code']; ?>
" <?php if (($this->_foreach['langF']['iteration'] <= 1)): ?>class="active"<?php endif; ?>><?php echo $this->_tpl_vars['language']['name']; ?>
</li>
							<?php endforeach; endif; unset($_from); ?>
						</ul>
					<?php endif; ?>
					
					<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['language']):
        $this->_foreach['langF']['iteration']++;
?>
						<?php if (count($this->_tpl_vars['allLangs']) > 1): ?><div class="tab_area<?php if (! ($this->_foreach['langF']['iteration'] <= 1)): ?> hide<?php endif; ?> <?php echo $this->_tpl_vars['language']['Code']; ?>
"><?php endif; ?>
						<input type="text" name="name[<?php echo $this->_tpl_vars['language']['Code']; ?>
]" value="<?php echo $this->_tpl_vars['sPost']['name'][$this->_tpl_vars['language']['Code']]; ?>
" maxlength="350" />
						<?php if (count($this->_tpl_vars['allLangs']) > 1): ?>
								<span class="field_description_noicon"><?php echo $this->_tpl_vars['lang']['name']; ?>
 (<b><?php echo $this->_tpl_vars['language']['name']; ?>
</b>)</span>
							</div>
						<?php endif; ?>
					<?php endforeach; endif; unset($_from); ?>
				</td>
			</tr>
			
			<tr>
				<td class="name"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['block_side']; ?>
</td>
				<td class="field">
					<select name="side">
						<option value=""><?php echo $this->_tpl_vars['lang']['select']; ?>
</option>
						<?php $_from = $this->_tpl_vars['l_block_sides']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['sides_f'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['sides_f']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['sKey'] => $this->_tpl_vars['block_side']):
        $this->_foreach['sides_f']['iteration']++;
?>
						<option value="<?php echo $this->_tpl_vars['sKey']; ?>
" <?php if ($this->_tpl_vars['sKey'] == $this->_tpl_vars['sPost']['side']): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['block_side']; ?>
</option>
						<?php endforeach; endif; unset($_from); ?>
					</select>
				</td>
			</tr>

			<tr>
				<td class="name"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['block_type']; ?>
</td>
				<td class="field">
					<select <?php if (! empty ( $this->_tpl_vars['block']['Plugin'] ) && $this->_tpl_vars['block']['Type'] != 'html'): ?>disabled="disabled"<?php endif; ?> onchange="block_banner('btype_'+$(this).val(), '#btypes div');" name="type" class="<?php if (! empty ( $this->_tpl_vars['block']['Plugin'] ) && $this->_tpl_vars['block']['Type'] != 'html'): ?>disabled<?php endif; ?>">
						<option value=""><?php echo $this->_tpl_vars['lang']['select']; ?>
</option>
						<?php $_from = $this->_tpl_vars['l_block_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['types_f'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['types_f']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['tKey'] => $this->_tpl_vars['block_type']):
        $this->_foreach['types_f']['iteration']++;
?>
						<option value="<?php echo $this->_tpl_vars['tKey']; ?>
" <?php if ($this->_tpl_vars['tKey'] == $this->_tpl_vars['sPost']['type']): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['block_type']; ?>
</option>
						<?php endforeach; endif; unset($_from); ?>
					</select>
					<?php if (! empty ( $this->_tpl_vars['block']['Plugin'] ) && $this->_tpl_vars['block']['Type'] != 'html'): ?><input type="hidden" name="type" value="<?php echo $this->_tpl_vars['sPost']['type']; ?>
" /><?php endif; ?>
				</td>
			</tr>
			</table>
			
			<div id="btypes">
			
			<div id="btype_other" class="hide">
				<table class="form">
				<tr>
					<td class="name"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['content']; ?>
</td>
					<td class="field">
						<textarea <?php if (! empty ( $this->_tpl_vars['block']['Plugin'] ) && $this->_tpl_vars['block']['Type'] != 'html'): ?>readonly="readonly"<?php endif; ?> rows="6" cols="" name="content" class="<?php if (! empty ( $this->_tpl_vars['block']['Plugin'] ) && $this->_tpl_vars['block']['Type'] != 'html'): ?>disabled<?php endif; ?>"><?php echo $this->_tpl_vars['sPost']['content']; ?>
</textarea>
					</td>
				</tr>
				</table>
			</div>
			
			<div class="hide" id="btype_html">
				<table class="form">
				<tr>
					<td class="name"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['content']; ?>
</td>
					<td class="field">
						<?php if (count($this->_tpl_vars['allLangs']) > 1): ?>
							<ul class="tabs">
								<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['language']):
        $this->_foreach['langF']['iteration']++;
?>
								<li lang="<?php echo $this->_tpl_vars['language']['Code']; ?>
" <?php if (($this->_foreach['langF']['iteration'] <= 1)): ?>class="active"<?php endif; ?>><?php echo $this->_tpl_vars['language']['name']; ?>
</li>
								<?php endforeach; endif; unset($_from); ?>
							</ul>
						<?php endif; ?>
						
						<?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['language']):
        $this->_foreach['langF']['iteration']++;
?>
							<?php if (count($this->_tpl_vars['allLangs']) > 1): ?><div class="tab_area<?php if (! ($this->_foreach['langF']['iteration'] <= 1)): ?> hide<?php endif; ?> <?php echo $this->_tpl_vars['language']['Code']; ?>
"><?php endif; ?>
							<?php $this->assign('dCode', ((is_array($_tmp='html_content_')) ? $this->_run_mod_handler('cat', true, $_tmp, $this->_tpl_vars['language']['Code']) : smarty_modifier_cat($_tmp, $this->_tpl_vars['language']['Code']))); ?>
							<?php echo rlSmarty::fckEditor(array('name' => ((is_array($_tmp='html_content_')) ? $this->_run_mod_handler('cat', true, $_tmp, $this->_tpl_vars['language']['Code']) : smarty_modifier_cat($_tmp, $this->_tpl_vars['language']['Code'])),'width' => '100%','height' => '140','value' => $this->_tpl_vars['sPost'][$this->_tpl_vars['dCode']]), $this);?>

							<?php if (count($this->_tpl_vars['allLangs']) > 1): ?></div><?php endif; ?>
						<?php endforeach; endif; unset($_from); ?>
					</td>
				</tr>
				</table>
			</div>
			
			</div>
		
			<table class="form">
			<tr>
				<td class="name"><?php echo $this->_tpl_vars['lang']['show_on_pages']; ?>
</td>
				<td class="field" id="pages_obj">
					<fieldset class="light">
						<?php $this->assign('pages_phrase', 'admin_controllers+name+pages'); ?>
						<legend id="legend_pages" class="up"><?php echo $this->_tpl_vars['lang'][$this->_tpl_vars['pages_phrase']]; ?>
</legend>
						<div id="pages">
							<div id="pages_cont" <?php if (! empty ( $this->_tpl_vars['sPost']['show_on_all'] )): ?>style="display: none;"<?php endif; ?>>
								<?php $this->assign('bPages', $this->_tpl_vars['sPost']['pages']); ?>
								<table class="sTable" style="margin-bottom: 15px;">
								<tr>
									<td valign="top">
									<?php $_from = $this->_tpl_vars['pages']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['pagesF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['pagesF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['page']):
        $this->_foreach['pagesF']['iteration']++;
?>
									<?php $this->assign('pId', $this->_tpl_vars['page']['ID']); ?>
									<div style="padding: 2px 8px;">
										<input class="checkbox" <?php if (isset ( $this->_tpl_vars['bPages'][$this->_tpl_vars['pId']] )): ?>checked="checked"<?php endif; ?> id="page_<?php echo $this->_tpl_vars['page']['ID']; ?>
" type="checkbox" name="pages[<?php echo $this->_tpl_vars['page']['ID']; ?>
]" value="<?php echo $this->_tpl_vars['page']['ID']; ?>
" /> <label class="cLabel" for="page_<?php echo $this->_tpl_vars['page']['ID']; ?>
"><?php echo $this->_tpl_vars['page']['name']; ?>
</label>
									</div>
									<?php $this->assign('perCol', ((is_array($_tmp=$this->_foreach['pagesF']['total']/3)) ? $this->_run_mod_handler('ceil', true, $_tmp) : ceil($_tmp))); ?>
				
									<?php if ($this->_foreach['pagesF']['iteration'] % $this->_tpl_vars['perCol'] == 0): ?>
										</td>
										<td valign="top">
									<?php endif; ?>
									<?php endforeach; endif; unset($_from); ?>
									</td>
								</tr>
								</table>
							</div>
							
							<div class="grey_area" style="margin: 0 0 5px;">
								<label><input id="show_on_all" <?php if ($this->_tpl_vars['sPost']['show_on_all']): ?>checked="checked"<?php endif; ?> type="checkbox" name="show_on_all" value="true" /> <?php echo $this->_tpl_vars['lang']['sticky']; ?>
</label>
								<span id="pages_nav" <?php if ($this->_tpl_vars['sPost']['show_on_all']): ?>class="hide"<?php endif; ?>>
									<span onclick="$('#pages_cont input').attr('checked', true);" class="green_10"><?php echo $this->_tpl_vars['lang']['check_all']; ?>
</span>
									<span class="divider"> | </span>
									<span onclick="$('#pages_cont input').attr('checked', false);" class="green_10"><?php echo $this->_tpl_vars['lang']['uncheck_all']; ?>
</span>
								</span>
							</div>
						</div>
					</fieldset>
					
					<script type="text/javascript">
					<?php echo '
					
					$(document).ready(function(){
						$(\'#legend_pages\').click(function(){
							fieldset_action(\'pages\');
						});
						
						$(\'input#show_on_all\').click(function(){
							$(\'#pages_cont\').slideToggle();
							$(\'#pages_nav\').fadeToggle();
						});
						
						$(\'#pages input\').click(function(){
							if ( $(\'#pages input:checked\').length > 0 )
							{
								//$(\'#show_on_all\').prop(\'checked\', false);
							}
						});
					});
					
					'; ?>

					</script>
				</td>
			</tr>
			
			<tr>
				<td class="name"><?php echo $this->_tpl_vars['lang']['show_in_categories']; ?>
</td>
				<td class="field">
					<fieldset class="light">
						<legend id="legend_cats" class="up" onclick="fieldset_action('cats');"><?php echo $this->_tpl_vars['lang']['categories']; ?>
</legend>
						<div id="cats">						
						
							<div id="cat_checkboxed" style="margin: 0 0 8px;<?php if ($this->_tpl_vars['sPost']['cat_sticky']): ?>display: none<?php endif; ?>">
								<div class="tree">
									<?php $_from = $this->_tpl_vars['sections']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['section']):
?>
										<fieldset class="light">
											<legend id="legend_section_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="up" onclick="fieldset_action('section_<?php echo $this->_tpl_vars['section']['ID']; ?>
');"><?php echo $this->_tpl_vars['section']['name']; ?>
</legend>
											<div id="section_<?php echo $this->_tpl_vars['section']['ID']; ?>
">
												<?php if (! empty ( $this->_tpl_vars['section']['Categories'] )): ?>
													<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'category_level_checkbox.tpl') : smarty_modifier_cat($_tmp, 'category_level_checkbox.tpl')), 'smarty_include_vars' => array('categories' => $this->_tpl_vars['section']['Categories'],'first' => true)));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
												<?php else: ?>
													<div style="padding: 0 0 8px 10px;"><?php echo $this->_tpl_vars['lang']['no_items_in_sections']; ?>
</div>
												<?php endif; ?>
											</div>
										</fieldset>
									<?php endforeach; endif; unset($_from); ?>
								</div>
								
								<div style="padding: 0 0 6px 37px;">
									<label><input <?php if (! empty ( $this->_tpl_vars['sPost']['subcategories'] )): ?>checked="checked"<?php endif; ?> type="checkbox" name="subcategories" value="1" /> <?php echo $this->_tpl_vars['lang']['include_subcats']; ?>
</label>
								</div>
							</div>
								
							<script type="text/javascript">
							var tree_selected = <?php if ($_POST['categories']): ?>[<?php $_from = $_POST['categories']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['postcatF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['postcatF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['post_cat']):
        $this->_foreach['postcatF']['iteration']++;
?>['<?php echo $this->_tpl_vars['post_cat']; ?>
']<?php if (! ($this->_foreach['postcatF']['iteration'] == $this->_foreach['postcatF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
							var tree_parentPoints = <?php if ($this->_tpl_vars['parentPoints']): ?>[<?php $_from = $this->_tpl_vars['parentPoints']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['parentF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['parentF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['parent_point']):
        $this->_foreach['parentF']['iteration']++;
?>['<?php echo $this->_tpl_vars['parent_point']; ?>
']<?php if (! ($this->_foreach['parentF']['iteration'] == $this->_foreach['parentF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
							<?php echo '
							
							$(document).ready(function(){
								flynax.treeLoadLevel(\'checkbox\', \'flynax.openTree(tree_selected, tree_parentPoints)\', \'div#cat_checkboxed\');
								flynax.openTree(tree_selected, tree_parentPoints);
								
								$(\'input[name=cat_sticky]\').click(function(){
									$(\'#cat_checkboxed\').slideToggle();
									$(\'#cats_nav\').fadeToggle();
								});
							});
							
							'; ?>

							</script>
			
							<div class="grey_area">
								<label><input class="checkbox" <?php if ($this->_tpl_vars['sPost']['cat_sticky']): ?>checked="checked"<?php endif; ?> type="checkbox" name="cat_sticky" value="true" /> <?php echo $this->_tpl_vars['lang']['sticky']; ?>
</label>
								<span id="cats_nav" <?php if ($this->_tpl_vars['sPost']['cat_sticky']): ?>class="hide"<?php endif; ?>>
									<span onclick="$('#cat_checkboxed div.tree input').attr('checked', true);" class="green_10"><?php echo $this->_tpl_vars['lang']['check_all']; ?>
</span>
									<span class="divider"> | </span>
									<span onclick="$('#cat_checkboxed div.tree input').attr('checked', false);" class="green_10"><?php echo $this->_tpl_vars['lang']['uncheck_all']; ?>
</span>
								</span>
							</div>
							
						</div>
					</fieldset>
				</td>
			</tr>
			
			<tr>
				<td class="name"><?php echo $this->_tpl_vars['lang']['use_block_design']; ?>
</td>
				<td class="field">
					<?php if ($this->_tpl_vars['sPost']['tpl'] == '1'): ?>
						<?php $this->assign('tpl_yes', 'checked="checked"'); ?>
					<?php elseif ($this->_tpl_vars['sPost']['tpl'] == '0'): ?>
						<?php $this->assign('tpl_no', 'checked="checked"'); ?>
					<?php else: ?>
						<?php $this->assign('tpl_yes', 'checked="checked"'); ?>
					<?php endif; ?>
					<label><input <?php echo $this->_tpl_vars['tpl_yes']; ?>
 class="lang_add" type="radio" name="tpl" value="1" /> <?php echo $this->_tpl_vars['lang']['yes']; ?>
</label>
					<label><input <?php echo $this->_tpl_vars['tpl_no']; ?>
 class="lang_add" type="radio" name="tpl" value="0" /> <?php echo $this->_tpl_vars['lang']['no']; ?>
</label>
				</td>
			</tr>
			
			<?php echo rlHook::load(array('name' => 'apTplBlocksForm'), $this);?>

			
			<tr>
				<td class="name"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['status']; ?>
</td>
				<td class="field">
					<select name="status">
						<option value="active" <?php if ($this->_tpl_vars['sPost']['status'] == 'active'): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['lang']['active']; ?>
</option>
						<option value="approval" <?php if ($this->_tpl_vars['sPost']['status'] == 'approval'): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['lang']['approval']; ?>
</option>
					</select>
				</td>
			</tr>
			<tr>
				<td></td>
				<td class="field">
					<input type="submit" value="<?php if ($_GET['action'] == 'edit'): ?><?php echo $this->_tpl_vars['lang']['edit']; ?>
<?php else: ?><?php echo $this->_tpl_vars['lang']['add']; ?>
<?php endif; ?>" />
				</td>
			</tr>
			</table>
		</form>
	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	<!-- add new block end -->
	
	<!-- select category action -->
	<script type="text/javascript">
	
	<?php echo '
	function cat_chooser(cat_id){
		return true;
	}
	'; ?>

	
	<?php if ($_POST['parent_id']): ?>
		cat_chooser('<?php echo $_POST['parent_id']; ?>
');
	<?php elseif ($_GET['parent_id']): ?>
		cat_chooser('<?php echo $_GET['parent_id']; ?>
');
	<?php endif; ?>

	</script>
	<!-- select category action end -->
	
	<!-- additional JS -->
	<?php if ($this->_tpl_vars['sPost']['type']): ?>
	<script type="text/javascript">
	<?php echo '
	$(document).ready(function(){
		block_banner(\'btype_'; ?>
<?php echo $this->_tpl_vars['sPost']['type']; ?>
<?php echo '\', \'#btypes div\');
	});
	
	'; ?>

	</script>
	<?php endif; ?>
	<!-- additional JS end -->
	
	<?php echo rlHook::load(array('name' => 'apTplBlocksAction'), $this);?>


<?php else: ?>

	<script type="text/javascript">
	// blocks sides list
	var block_sides = [
	<?php $_from = $this->_tpl_vars['l_block_sides']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['sides_f'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['sides_f']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['sKey'] => $this->_tpl_vars['block_side']):
        $this->_foreach['sides_f']['iteration']++;
?>
		['<?php echo $this->_tpl_vars['sKey']; ?>
', '<?php echo $this->_tpl_vars['block_side']; ?>
']<?php if (! ($this->_foreach['sides_f']['iteration'] == $this->_foreach['sides_f']['total'])): ?>,<?php endif; ?>
	<?php endforeach; endif; unset($_from); ?>
	];
	</script>

	<!-- blocks grid -->
	<div id="grid"></div>
	<script type="text/javascript">//<![CDATA[
	var blocksGrid;
	
	<?php echo '
	$(document).ready(function(){
		
		blocksGrid = new gridObj({
			key: \'blocks\',
			id: \'grid\',
			ajaxUrl: rlUrlHome + \'controllers/blocks.inc.php?q=ext\',
			defaultSortField: \'name\',
			title: lang[\'ext_blocks_manager\'],
			fields: [
				{name: \'name\', mapping: \'name\', type: \'string\'},
				{name: \'Position\', mapping: \'Position\', type: \'int\'},
				{name: \'Status\', mapping: \'Status\'},
				{name: \'Type\', mapping: \'Type\'},
				{name: \'Tpl\', mapping: \'Tpl\'},
				{name: \'Side\', mapping: \'Side\'},
				{name: \'Key\', mapping: \'Key\'}
			],
			columns: [
				{
					header: lang[\'ext_name\'],
					dataIndex: \'name\',
					id: \'rlExt_item_bold\',
					width: 40
				},{
					header: lang[\'ext_type\'],
					dataIndex: \'Type\',
					id: \'rlExt_item\',
					width: 10
				},{
					header: lang[\'ext_block_side\'],
					dataIndex: \'Side\',
					width: 10,
					editor: new Ext.form.ComboBox({
						store: block_sides,
						displayField: \'value\',
						valueField: \'key\',
						typeAhead: true,
						mode: \'local\',
						triggerAction: \'all\',
						selectOnFocus:true
					}),
					renderer: function(val){
						return \'<span ext:qtip="\'+lang[\'ext_click_to_edit\']+\'">\'+val+\'</span>\';
					}
				},{
					header: lang[\'ext_position\'],
					dataIndex: \'Position\',
					width: 10,
					editor: new Ext.form.NumberField({
						allowBlank: false,
						allowDecimals: false
					}),
					renderer: function(val){
						return \'<span ext:qtip="\'+lang[\'ext_click_to_edit\']+\'">\'+val+\'</span>\';
					}
				},{
					header: lang[\'ext_block_style\'],
					dataIndex: \'Tpl\',
					width: 10,
					editor: new Ext.form.ComboBox({
						store: [
							[\'1\', lang[\'ext_yes\']],
							[\'0\', lang[\'ext_no\']]
						],
						displayField: \'value\',
						valueField: \'key\',
						typeAhead: true,
						mode: \'local\',
						triggerAction: \'all\',
						selectOnFocus:true
					}),
					renderer: function(val){
						return \'<span ext:qtip="\'+lang[\'ext_click_to_edit\']+\'">\'+val+\'</span>\';
					}
				},{
					header: lang[\'ext_status\'],
					dataIndex: \'Status\',
					width: 10,
					editor: new Ext.form.ComboBox({
						store: [
							[\'active\', lang[\'ext_active\']],
							[\'approval\', lang[\'ext_approval\']]
						],
						displayField: \'value\',
						valueField: \'key\',
						typeAhead: true,
						mode: \'local\',
						triggerAction: \'all\',
						selectOnFocus:true
					}),
					renderer: function(val){
						return \'<span ext:qtip="\'+lang[\'ext_click_to_edit\']+\'">\'+val+\'</span>\';
					}
				},{
					header: lang[\'ext_actions\'],
					width: 70,
					fixed: true,
					dataIndex: \'Key\',
					sortable: false,
					renderer: function(data) {
						var out = "<center>";
						var splitter = false;
						
						if ( rights[cKey].indexOf(\'edit\') >= 0 )
						{
							out += "<a href=\'"+rlUrlHome+"index.php?controller="+controller+"&action=edit&block="+data+"\'><img class=\'edit\' ext:qtip=\'"+lang[\'ext_edit\']+"\' src=\'"+rlUrlHome+"img/blank.gif\' /></a>";
						}
						if ( rights[cKey].indexOf(\'delete\') >= 0 )
						{
							out += "<img class=\'remove\' ext:qtip=\'"+lang[\'ext_delete\']+"\' src=\'"+rlUrlHome+"img/blank.gif\' onclick=\'rlConfirm( \\""+lang[\'ext_notice_\'+delete_mod]+"\\", \\"xajax_deleteBlock\\", \\""+Array(data)+"\\", \\"section_load\\" )\' />";
						}
						out += "</center>";
						
						return out;
					}
				}
			]
		});
		
		'; ?>
<?php echo rlHook::load(array('name' => 'apTplBlocksGrid'), $this);?>
<?php echo '
		
		blocksGrid.init();
		grid.push(blocksGrid.grid);
		
	});
	'; ?>

	//]]>
	</script>
	<!-- blocks grid end -->

	<?php echo rlHook::load(array('name' => 'apTplBlocksBottom'), $this);?>

<?php endif; ?>

<!-- blocks tpl end -->